package com.orbitdevs.testgame.graphics;

import com.badlogic.gdx.graphics.OrthographicCamera;

public class SmartCamera extends OrthographicCamera {
	private float w;
	private float h;
	private float xPos;
	private float yPos;
	private boolean moving;

	public SmartCamera(float w, float h) {
		super(w, h);
		this.w = w;
		this.h = h;
		moving = false;
	}
	
	/** Moves the camera by the given offsets */
	public void move(float x, float y) {
		this.translate(x, y);
		xPos += x;
		yPos += y;
	}
	
	/** Moves the camera to the given position */
	public void moveTo(float xTarg, float yTarg) {
		float xStep = xTarg - xPos;
		float yStep = yTarg - yPos;
		this.move(xStep, yStep);
	}
	
	public void smoothMove(float xTarg, float yTarg, float dt){
		float xStep = (xTarg - xPos)*9f * dt;
		float yStep = (yTarg - yPos)*9f * dt;
		this.move(xStep, yStep);

	}

	public boolean isMoving() {
		return moving;
	}

	public float getxPos(){
		return xPos;
	}
	
	public float getyPos(){
		return yPos;
	}
}
